Subject: Re: BOOPSI Class Names
From: [email-masked] (Christoph Feck IRZ)
Date: Sun, 8 May 1994 14:56:19 GMT
Newsgroups: comp.sys.amiga.programmer

In article <[email-masked]>, [email-masked] (Mark A. Thomas) writes:
> >: Another possibility is to not worry about possible conflicts.  Is anyone
> >
> >Yes, don't worry. If you provide the class as linkable code (please do), you

Please don't!

> >should make it unnamed, I mean to use it the programmer only have to get the
> >class pointer returned by MakeClass().

> Well, my class is a library, not a linkable module.  The reason is that it
> is more sensible when the gadget is used in multiple programs since only
> one copy of the code is in memory, as opposed to one copy per program if
> it was linkable.

The solution is simple:  Make your library have _one_ LVO (let's
call it GetClass() here).  It should return a pointer to the Class
which has to be used to create new objects.  This pointer has
to be valid as long as the library has an OpenCount != 0 or has
subclasses or subobjects.

There is actually no need bother about the names of the classes
but it's the name of the library.  I'd suggest the way C= does it
with datatypes and gadgets.  E.g., if you have an BOOPSI gadget
class, put it in SYS:Classes/Gadgets/<name>.gadget, if you have
a subclass of imageclass, the name would be SYS:Classes/Images/
<name>.image etc.  If you have a _new_ class which is not subclass
of an existing class (ie. a subclass of rootclass, icclass or model
class :) create a new drawer in SYS:Classes/

I have e.g. classes for 24 bit display and it looks like this:

SYS:Classes/
	Gadgets/
		xxxx.gadget
	DataTypes/
		xxxx.datatype
	displayclass	(subclass of icclass)
	Displays/
		amiga.display
		picasso.display
		(etc).

As for the serialclass someone mentioned:  Don't ever call a class
(or library) just serialclass.  I assume the class is needed for
serial device I/O.  Well, why not have a (device-independed) inter-
face to data streams, and then built device depended classes on
top of it?  I have a class called 'streamclass' and then I built
a few subclasses:

SYS:Classes/
	streamclass
	Streams/
		file.stream
		memory.stream
		device.stream
		clipboard.stream
			(this one is a subclass of device.stream)

Now, a serial.stream (subclass of device.stream, no need to bother
with Exec IO functions etc.) would make sense.  Additional attributes
and methods would need to be defined, of course (e.g. setting baud
rate or whatever).

Think a bit object oriented when designing classes.  It is nearly
always possible to make a 'super'class which actually doesn't do
anything but sets the standard attributes and methods, so programs
designed to use these attributes can also use any new subclass.
Think about a parallel.stream.  It would be nearly the same code
like in serial.stream.  Having a device.stream has two advantages:
Space saving, and you benefit from any improvements made in the
super classes.

I think that's enough for now :)

3k// Christoph Feck, TowerSystems - BOOPSI Class Development
\X/ Amiga - Intuition inside.